package com.hbnu.exercise.basic;

import java.util.Scanner;

public class Demo04_ShoppingSystem
{
    public static void main(String[] args)
    {
        HomePage();
    }
    public static void HomePage()
    {
        System.out.println("**********");
        System.out.println("欢迎来到黄石购物系统");
        System.out.println("1.进入系统");
        System.out.println("2.退出");
        System.out.println("**********");
        switch (Input(2))
        {
            case 1:
                SystemMenu();
                break;
            case 2:
                System.exit(0);
                break;
        }
    }

    public static void SystemMenu()
    {
        System.out.println("**********");
        System.out.println("请选择你要使用的功能");
        System.out.println("1.客户信息管理");
        System.out.println("2.真情回顾");
        System.out.println("3.返回上一级菜单");
        System.out.println("**********");
        switch (Input(3))
        {
            case 1 :
                CustomerManage();
                break;
            case 2:
                SincereMemory();
                break;
            case 3:
                HomePage();
                break;
        }
    }

    public static void CustomerManage()
    {
        System.out.println("欢迎来到客户信息管理，请选择你需要的功能");
        System.out.println("1.客户信息的添加");
        System.out.println("2.客户信息的修改");
        System.out.println("3.客户信息的删除");
        System.out.println("4.返回上一级菜单");
        switch (Input(4))
        {
            case 1:
                AddCustomer();
                break;
            case 2:
                ModifyCustomer();
                break;
            case 3:
                DeleteCustomer();
                break;
            case 4:
                SystemMenu();
                break;
        }
    }

    public static void AddCustomer()
    {
        System.out.println("请选择你要使用的功能");
        System.out.println("1.添加客户");
        System.out.println("2.返回上一级菜单");
        switch (Input(2))
        {
            case 1:
                System.out.println("实现添加客户功能");
            case 2:
                CustomerManage();
        }
    }

    public static void ModifyCustomer()
    {
        System.out.println("请选择你要使用的功能");
        System.out.println("1.修改客户");
        System.out.println("2.返回上一级菜单");
        switch (Input(2))
        {
            case 1:
                System.out.println("实现修改客户功能");
            case 2:
                CustomerManage();
        }
    }

    public static void DeleteCustomer()
    {
        System.out.println("请选择你要使用的功能");
        System.out.println("1.删除客户");
        System.out.println("2.返回上一级菜单");
        switch (Input(2))
        {
            case 1:
                System.out.println("实现删除客户功能");
            case 2:
                CustomerManage();
        }
    }

    public static void SincereMemory()
    {
        System.out.println("请选择你要使用的功能");
        System.out.println("1.生日问候");
        System.out.println("2.幸运抽奖");
        System.out.println("3.幸运大放送");
        System.out.println("4.返回上一级菜单");
        switch (Input(4))
        {
            case 1:
                HappyBirthday();
                break;
            case 2:
                LuckyLottery();
                break;
            case 3:
                LuckyDistribution();
                break;
            case 4:
                SystemMenu();
                break;
        }
    }

    public static void HappyBirthday()
    {
        System.out.println("请选择你要使用的功能");
        System.out.println("1.生日问候");
        System.out.println("2.返回上一级菜单");
        switch (Input(2))
        {
            case 1:
                System.out.println("实现生日问候功能");
                break;
            case 2:
                SincereMemory();
                break;
        }
    }

    public static void LuckyLottery()
    {
        System.out.println("请选择你要使用的功能");
        System.out.println("1.幸运抽奖");
        System.out.println("2.返回上一级菜单");
        switch (Input(2))
        {
            case 1:
                System.out.println("实现幸运抽奖功能");
                break;
            case 2:
                SincereMemory();
                break;
        }
    }

    public static void LuckyDistribution()
    {
        System.out.println("请选择你要使用的功能");
        System.out.println("1.幸运大放送");
        System.out.println("2.返回上一级菜单");
        switch (Input(2))
        {
            case 1:
                System.out.println("实现幸运大放送功能");
                break;
            case 2:
                SincereMemory();
                break;
        }
    }

    public static int Input(int i)
    {
        Scanner scanner = new Scanner(System.in);
        int n;
        n = scanner.nextInt();
        while (n > i || n < 1)
        {
            System.out.println("输入数字错误，请重新输入");
            n = scanner.nextInt();
        }
        return n;
    }
}
